/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package swing;

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JOptionPane;

/**
 *
 * @author Iskandar Sarkawi
 */
public class Example3b_Handler extends Example3a_GUI implements ActionListener {

    public void actionPerformed(ActionEvent event){

        String message = "";
        
        if(event.getSource() == super.txtField1)
            message = String.format("Field 1: %s", event.getActionCommand());
        else if(event.getSource() == super.txtField2)
            message = String.format("Field 2: %s", event.getActionCommand());
        else if(event.getSource() == super.txtField3)
            message = String.format("Field 3: %s", event.getActionCommand());
        else if(event.getSource() == super.passwordField)
            message = String.format("Password field is: %s", event.getActionCommand());
        
        JOptionPane.showMessageDialog(null, message);
    }

}
